#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
int main()
{
	char num[31];
	char ch;

	int d;
	d = 0;
	while (ch = getchar(), ch != '\n')
		d = d * 2 + (ch - '0');

	printf("%d", d);
	return 0;
}